
/**
 * created on 2012-04-28
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-04-28         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.qjz.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.qjz.dao.IUserInfoDao;
import com.qjz.entity.UserInfoTo;	

public class UserInfoDaoImpl extends BaseDaoImpl implements IUserInfoDao {
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #searchUserInfoList(java.util.Map)
	 */
	public List<UserInfoTo> searchUserInfoList(
			Map<String, Object> paramMap) {
		return this.queryForList("userInfo.searchUserInfo", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #searchUserInfoPagination(java.util.Map, int, int)
	 */
	public List<UserInfoTo> searchUserInfoPagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("userInfo.searchUserInfo",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #getUserInfoCount(java.util.Map)
	 */
	public Integer getUserInfoCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("userInfo.getUserInfoCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #getUserInfoByPrimaryKey(int)
	 */
	public UserInfoTo getUserInfoByPrimaryKey(int uid) {
		return (UserInfoTo) queryForObject("userInfo.getUserInfoByPrimaryKey", uid);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #insertUserInfo(com.qjz.entity.UserInfoTo)
	 */
	public Object insertUserInfo(UserInfoTo userInfo) {
		return this.create("userInfo.insertUserInfo", userInfo);		
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #updateUserInfoByBean(com.qjz.entity.UserInfoTo)
	 */
	public int updateUserInfoByBean(UserInfoTo userInfo) {
		return this.update("userInfo.updateUserInfo.byBean", userInfo);
	}

	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #updateUserInfoByProperty(java.util.Map)
	 */
	public int updateUserInfoByProperty(Map<String, Object> paramMap) {
		return this.update("userInfo.updateUserInfo.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #deleteUserInfoByPrimaryKey(int)
	 */
	public int deleteUserInfoByPrimaryKey(int uid) {
		return this.delete("userInfo.deleteUserInfoByPrimaryKey", uid);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.qjz.dao.IUserInfoDao
	 *      #deleteUserInfoBatch(int[])
	 */
	public void deleteUserInfoBatch(int[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (int key : keyArray) {
				sqlMap.delete("userInfo.deleteUserInfoByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
		
}	
	
